﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using ThaireInvestmentWeb.Models;
using ThaireInvestmentWeb.WcfSerivce;

namespace ThaireInvestmentWeb.BusinessDelegate
{
    public class ServiceDelegate
    {

        String UserID = "TestUser";
        public ServiceDelegate()
        {
            _service = new WcfSerivce.InvestmentServiceClient();
        }
        WcfSerivce.InvestmentServiceClient _service = null;

        #region common

        //internal DateTime GetSystemDateTime()
        //{
        //    return _service.GetSystemDateTime();
        //}

        #endregion

        #region Instrument --> FixedIncome

        //public ManageInstructionScreenData GetManageInstructionScreenData()
        //{

        //    return _service.GetManageInstructionScreenData();
        //}

        //public List<ManageInstructionDTO> SearchInstructionDTO(SearchInstructionFilter filter)
        //{

        //    return new List<ManageInstructionDTO>(_service.SearchInstructionDTO(filter));
        //}

        //public FixedIncomeHeaderScreenData GetFixedIncomeHeaderScreenData()
        //{
        //    return _service.GetFixedIncomeHeaderScreenData();
        //}

        //public FixedIncomeListData GetFixedIncomeListScreenData()
        //{
        //    return _service.GetFixedIncomeListScreenData();

        //}

        //public InstructionFormScreenData GetInstructionFormScreenData(int headerID)
        //{
        //    return _service.GetInstructionFormScreenData(headerID);

        //}
        //public InstructionFormScreenData SaveInstruction(InstructionHeader header, InstructionDetail[] details)
        //{
        //    return _service.SaveInstruction(header, details);

        //}

        //public void DeleteInstruction(int[] delID)
        //{
        //    _service.DeleteInstruction(delID);

        //}

        //public FixIncomeSecuritiesDTO InsertFixIncomeHeader(AddFixedIncomeModel model)
        //{
        //    FixIncomeSecuritiesDTO dto = new FixIncomeSecuritiesDTO();
        //    dto.Header = model.Data;
        //    dto.RatingHistory = model.RatingHistory;
        //    dto.Header.CreateUserId = UserID;

        //    return _service.InsertFixIncomeHeader(dto);
        //    //return null;
        //}

        //public FixIncomeSecuritiesDTO UpdateFixIncomeHeader(AddFixedIncomeModel model)
        //{
        //    FixIncomeSecuritiesDTO dto = new FixIncomeSecuritiesDTO();
        //    dto.Header = model.Data;
        //    dto.RatingHistory = model.RatingHistory;
        //    dto.Header.UpdateUserId = UserID;
        //    dto.RatingHistory.CreateUserId = UserID;
        //    return _service.UpdateFixIncomeHeader(dto);
        //    //return null;
        //}

        //public FixIncomeSecuritiesDTO GetFixedIncomeSecurities(int FixedIncomeSecuritiesID)
        //{
        //    FixIncomeSecuritiesDTO dto = _service.GetFixIncomeHeaderByID(FixedIncomeSecuritiesID);
        //    return dto;
        //}

        //public List<FixIncomeSecuritiesHeader> SearchFixedIncomeSecurities(SearchFixedIncomeSecuritiesModel model)
        //{
        //    return new List<FixIncomeSecuritiesHeader>(_service.SearchFiexdIncome(model.ToSearchFiexdIncomeFilter()));
        //}



        ////TODO: temp
        //public FixIncomeSecuritiesDTO InsertFixIncomePurchase(AddFixedIncomeModel model)
        //{
        //    var dto = new FixIncomeSecuritiesDTO();
        //    dto.Header = model.Data;
        //    dto.RatingHistory = model.RatingHistory;
        //    dto.Header.CreateUserId = UserID;

        //    return _service.InsertFixIncomeHeader(dto);
        //    //return null;
        //}
        //TODO: temp
        //public List<FixincomesecuritiesPurchase> SearchFixedIncomeSecuritiesPurchases(SearchFixedIncomeSecuritiesModel model)
        //{
        //    return new List<FixincomesecuritiesPurchase>(_service.GetFixIncomePurchasesByHeaderId(1));
        //}
        //TODO: temp
        //public FixIncomeSecuritiesHeader GetFixedIncomeSecuritiesHeaderById(int headerId)
        //{
        //    return _service.GetFixedIncomeSecuritiesHeaderById(headerId);
        //}

        //internal FixincomesecuritiesPurchase InsertFixedIncomePurchase(FixincomesecuritiesPurchase fixincomesecuritiesPurchase)
        //{
        //    fixincomesecuritiesPurchase.CreateUserId = UserID;
        //    return _service.InsertFixedIncomePurchase(fixincomesecuritiesPurchase);
        //}
        //internal FixIncomeSecuritiesDTO GetFixIncomeHeaderByID(int headerId)
        //{
        //    return _service.GetFixIncomeHeaderByID(headerId);
        //}
        //internal IList<CounterParties> GetAllCounterPaties()
        //{
        //    return _service.GetAllCounterPaties();
        //}

        //internal IList<PaymentType> GetAllPaymentTypes()
        //{
        //    return _service.GetAllPaymentTypes();
        //}


        //public FixincomesecuritiesPurchaseDTO GetFixIncomePurchaseByID(int purchaseID)
        //{
        //    return _service.GetFixIncomePurchaseByID(purchaseID);
        //}

        //public FixIncomeSecuritiesTransactionScreenData GetFixIncomeSecuritiesTransactionScreenData(int purchaseID,int? transactionID)
        //{
        //    return _service.GetFixIncomeSecuritiesTransactionScreenData(purchaseID, transactionID);
        //}




        //public FixIncomeSecuritiesTransaction InsertFixIncomeSecuritiesTransaction(FixIncomeSecuritiesTransaction fixIncomeSecuritiesTransaction)
        //{
        //    fixIncomeSecuritiesTransaction.CreateUserId = UserID;
        //    return _service.InsertFixIncomeSecuritiesTransaction(fixIncomeSecuritiesTransaction);
        //}

        //internal FixIncomeSecuritiesTransaction UpdateFixIncomeSecuritiesTransaction(FixIncomeSecuritiesTransaction fixIncomeSecuritiesTransaction)
        //{
        //    return _service.UpdateFixIncomeSecuritiesTransaction(fixIncomeSecuritiesTransaction);
        //}

        //internal FixincomesecuritiesPurchase UpdateFixincomesecuritiesPurchase(FixincomesecuritiesPurchase purchase)
        //{
        //    purchase.UpdateUserId = UserID;
        //    return _service.UpdateFixincomesecuritiesPurchase(purchase);
        //}


        #endregion

        //public IList<InstructionDataDTO> InstructionGetSelection(InstructionFormScreenData instructionFormScreenData)
        //{
        //    return _service.InstructionGetSelectionData(instructionFormScreenData);
        //}
    }
}